/**
 * 
 */
package org.dragonfire.editor.syntax.rules;

import org.eclipse.jface.text.rules.ICharacterScanner;
import org.eclipse.jface.text.rules.IRule;
import org.eclipse.jface.text.rules.IToken;
import org.eclipse.jface.text.rules.Token;

/**
 * @author Darth Android
 * @date Oct 3, 2007
 */
public class LineReturnRule implements IRule {

	/**
	 * {@inheritDoc}
	 */
	public IToken evaluate(ICharacterScanner scanner) {
		int c = scanner.read();
		if (c == 13 || c == 10)
			return Token.WHITESPACE;
		if (c == ICharacterScanner.EOF)
			return Token.EOF;
		scanner.unread();
		return Token.UNDEFINED;
	}
}
